package cn.edu.lingnan.servlet;

import cn.edu.lingnan.pojo.User;
import cn.edu.lingnan.service.userservice;
import cn.edu.lingnan.service.userserviceimp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/QueryStudentAllServlet")
public class QueryStudentAllServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        userservice us=new userserviceimp();

        String name = req.getParameter("name");
        System.out.println(name);
//        if (name!= null &&!name.equals("")) {
//            List<User> userList = us.getUserLikeName(name);
//            System.out.println(userList);
//            req.getServletContext().setAttribute("userList",userList);
//
//        }

            List<User> userList = us.selectall();

        req.getServletContext().setAttribute("userList", userList);



    }
}
